from distance import *
from compass import *
from direction import *
from gps import *
import time,android
def travel(route,source,end):
    droid = android.Android()
    end=list(end)
    turn_list=[]
    to_turn_list=[]
    latlon=[(route[0][0],route[0][1]),source]
    nearest=initial((route[1][0],route[1][1]),latlon)
    i=nearest.index(min(nearest))
    az=GetAzimuth()
    src=[source[0],source[1],0]
    dest=[route[i][0],route[i][1],0]
    res,trn=turn(az,src,dest)
    droid.ttsSpeak(trn)
    next_az=az+res
    for ll in range(i+1,len(route)-1):
        src=[route[ll][0],route[ll][1],0]
        dest=[route[ll+1][0],route[ll+1][1],0]
        res,trn=turn(az,src,dest)
        temp=next_az+res
        diff=abs(next_az-temp)
        if diff>0.65:
           a=(route[ll][0],route[ll][1])
           b=(route[ll+1][0],route[ll+1][1])
           turn_list.append(a)
           to_turn_list.append(b)
        next_az=temp
    droid.ttsSpeak("start")
    pos= gps()

